unit head;

interface

uses
  LConvEncoding,
  Windows,
  Sysutils;

const RW_OK = 0;

var
  CanDebug: Boolean = false;
  TxtMode: Boolean = false;
  WindowMode: Boolean = false;
  ConsoleMode: Boolean = false;
  Gamerun: Boolean;
  AUTOSETVIDEO: Boolean = true;
  VIDEOMODE : Integer = 0;
  GameFPS: integer = 60;
  WindowWidth: integer = 800;
  WindowHeight: integer = 600;

function STRtoAnsi(str: string): Ansistring;
function WideSTRtoAnsi(str: widestring): Ansistring;

implementation

function STRtoAnsi(str: string): Ansistring;
begin
  result := UTF8ToCP936(str);
end;

function WideSTRtoAnsi(str: widestring): Ansistring;
var
  len: integer;
begin
  len := WideCharToMultiByte(936, 0, PWideChar(str), -1, nil, 0, nil, nil);
  setlength(Result, len + 1);
  WideCharToMultiByte(936, 0, PWideChar(str), -1, PChar(Result), len + 1, nil, nil);
end;

end.
